from .base_logger import BaseLogger
from .model_logger import ModelLogger
from .image_saver import Fuse, BBox, Heatmap, Saliency, BkgHeatmap, AllCls, OrderCls, FeatureMaps, LevelHeatmap, \
    SalCamOrigincam


logger_dict = {'BaseLogger': BaseLogger,
               'ModelLogger': ModelLogger,
               }

image_saver_dict = {'Fuse': Fuse,
                    'BBox': BBox,
                    'Heatmap': Heatmap,
                    'Saliency': Saliency,
                    'BkgHeatmap': BkgHeatmap,
                    'AllCls': AllCls,
                    'OrderCls': OrderCls,
                    'FeatureMaps': FeatureMaps,
                    'LevelHeatmap': LevelHeatmap,
                    'SalCamOrigincam':  SalCamOrigincam,
                    }


def build_logger(log_cfg):
    cfg = log_cfg.copy()
    logger_cls = logger_dict[cfg.pop('type')]
    return logger_cls(**cfg)


def build_image_saver(log_cfg):
    cfg = log_cfg.copy()
    image_logger_cls = image_saver_dict[cfg.pop('type')]
    return image_logger_cls(**cfg)


__all__ = ['build_logger', 'build_image_saver']
